/*
 * @Author: HeAo
 * @Date: 2021-11-25 17:31:26
 * @LastEditTime: 2021-11-25 17:46:24
 * @LastEditors: HeAo
 * @Description:
 * @FilePath: \study\day03\3-数组.js
 * 别乱动！
 */
var arr = ['larry', 'terry', 'tom', 'jacky']

// for 循环
// for (let i = 0; i < arr.length; i++) {
//   console.log(arr[i]);
// }

// 数组的原生迭代api
arr.forEach(function (item, index) {
  console.log(item, index);
})

var arr1 = [
  { id: 1, name: 'zhangsan', age: 10, gendre: 'male' },
  { id: 2, name: 'lisi', age: 11, gendre: 'male' },
  { id: 3, name: 'wangwu', age: 16, gendre: 'female' },
]

let result1 = arr1.map(function (item) {
  return item.name
})
console.log(result1);

let result2 = arr1.filter(function (item) {
  return item.age < 15
})
console.log(result2);
